package com.rao.travel.service.impl;

import com.github.pagehelper.PageHelper;
import com.rao.travel.dao.OrdersDao;
import com.rao.travel.pojo.Orders;
import com.rao.travel.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Srao
 * @version 1.0
 * @className OrdersServiceImpl
 * @date 2019/10/29 11:18
 * @package com.rao.travel.service.impl
 * @description
 */
@Service
@Transactional
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    private OrdersDao ordersDao;

    @Override
    public List<Orders> findAll(Integer page, Integer pageSize) throws Exception {
        /*从第一页开始展示，每页展示五条*/
        PageHelper.startPage(page, pageSize);
        return ordersDao.findAll();
    }

    @Override
    public Orders findById(String id) throws Exception {
        return ordersDao.findById(id);
    }
}
